import request from '@/utils/request'

// 查询agent列表
export function listBase(query) {
  return request({
    url: '/agent/list',
    method: 'get',
    params: query
  })
}

// 新增agent
export function addBase(data) {
  return request({
    url: '/agent/add',
    method: 'post',
    data: data
  })
}

// 修改agent
export function updateBase(data) {
  return request({
    url: '/agent/update',
    method: 'post',
    data: data
  })
}

// 查询知识库列表
export function knowledgeListBase(query) {
  return request({
    url: '/agent/knowledge/list',
    method: 'get',
    params: query
  })
}

// 获取信贷报告生成文件
export function getGenerationFile(params) {
  return request({
    url: 'credit/report/generate',
    method: 'post',
    data: params,
    timeout: 86400000, // 24小时
    // headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
    responseType: 'blob',
  })
}

// 获取信贷报告生成文件
export function downloadGenerationFile() {
  return request({
    url: 'credit/report/download',
    method: 'get',
    // data: params,
    timeout: 86400000, // 24小时
    // headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
    responseType: 'blob',
  })
}

// 信贷报告生成进度
export function getProgress(params) {
  return request({
    url: `credit/report/generate/progress/${params}`,
    method: 'get',
    // params,
  })
}